<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>域名与线路容错机制说明</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#165DFF',
                        secondary: '#36CFC9',
                        success: '#52C41A',
                        warning: '#FAAD14',
                        danger: '#FF4D4F',
                    },
                    fontFamily: {
                        inter: ['Inter', 'system-ui', 'sans-serif'],
                        mono: ['JetBrains Mono', 'monospace'],
                    },
                }
            }
        }
    </script>
    <style type="text/tailwindcss">
        @layer utilities {
            .domain-highlight {
                @apply bg-white rounded-lg shadow-md p-3 border-l-4 transition-all duration-300 hover:shadow-lg;
            }
            .doc-link {
                @apply inline-flex items-center px-3 py-1.5 bg-primary text-white rounded-lg text-sm font-medium transition-all duration-300 hover:bg-primary/90 hover:shadow-lg;
            }
        }
    </style>
    <!-- 引入更适合展示域名的字体 -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap" rel="stylesheet">
</head>
<body class="bg-gray-50 font-inter text-gray-800 text-sm">
    <div class="max-w-4xl mx-auto px-4 py-6">
        <!-- 页面标题 -->
        <header class="text-center mb-6">
            <h1 class="text-[clamp(1.2rem,3vw,1.6rem)] font-bold text-primary mb-2">
                域名与线路容错机制说明
            </h1>
            <p class="text-gray-600 text-sm max-w-2xl mx-auto">
                为确保服务稳定性，我们提供了完整的域名体系与智能线路容错方案
            </p>
        </header>

        <!-- 域名信息部分 -->
        <section class="mb-8">
            <h2 class="text-[clamp(1rem,2vw,1.3rem)] font-semibold mb-4 flex items-center">
                <i class="fa fa-globe text-primary mr-2"></i>域名信息
            </h2>
            
            <!-- 主域名 -->
            <div class="mb-5">
                <h3 class="text-base font-semibold mb-2 text-gray-700">主域名</h3>
                <div class="domain-highlight border-primary">
                    <div class="flex flex-col md:flex-row md:items-center gap-2">
                        <code class="font-mono text-[16px] font-bold text-primary">wlyz.cn</code>
                        <span class="text-gray-500 text-sm"><i class="fa fa-check-circle text-success mr-1"></i> 首选主域名</span>
                    </div>
                </div>
                
                <div class="domain-highlight border-primary mt-2">
                    <div class="flex flex-col md:flex-row md:items-center gap-2">
                        <code class="font-mono text-[16px] font-bold text-primary">www.wlyz.cn</code>
                        <span class="text-gray-500 text-sm"><i class="fa fa-check-circle text-success mr-1"></i> 备用主域名</span>
                    </div>
                </div>
            </div>
            
            <!-- 备用域名 -->
            <div class="mb-5">
                <h3 class="text-base font-semibold mb-2 text-gray-700">备用域名</h3>
                <div class="domain-highlight border-secondary">
                    <div class="flex flex-col md:flex-row md:items-center gap-2">
                        <code class="font-mono text-[16px] font-bold text-secondary">api.wlyz.cn</code>
                        <span class="text-gray-500 text-sm"><i class="fa fa-backup text-secondary mr-1"></i> 备用域名 1</span>
                    </div>
                </div>
                
                <div class="domain-highlight border-secondary mt-2">
                    <div class="flex flex-col md:flex-row md:items-center gap-2">
                        <code class="font-mono text-[16px] font-bold text-secondary">ace.wlyz.cn</code>
                        <span class="text-gray-500 text-sm"><i class="fa fa-backup text-secondary mr-1"></i> 备用域名 2</span>
                    </div>
                </div>
            </div>
            
            <!-- 接口文档地址 -->
            <div class="mb-4 p-3 bg-blue-50 rounded-lg border border-blue-100">
                <h3 class="text-sm font-semibold mb-2 text-gray-700">接口文档</h3>
                <a href="http://acewlyz.apifox.cn/" target="_blank" class="doc-link">
                    <i class="fa fa-file-text-o mr-1.5"></i>
                    查看完整接口文档
                    <i class="fa fa-external-link ml-1.5"></i>
                </a>
            </div>
            
            <!-- 开发者建议 -->
            <div class="bg-primary/5 p-3 rounded-lg border border-primary/20">
                <p class="text-primary text-sm font-medium">
                    <i class="fa fa-lightbulb-o mr-1.5"></i>建议开发者按照此域名体系使用，以提高服务稳定性
                </p>
            </div>
        </section>

        <!-- 线路容错机制 -->
        <section class="mb-8">
            <h2 class="text-[clamp(1rem,2vw,1.3rem)] font-semibold mb-4 flex items-center">
                <i class="fa fa-sitemap text-primary mr-2"></i>线路容错机制
            </h2>
            
            <div class="bg-white rounded-xl shadow-md p-4 mb-5">
                <div class="mb-4">
                    <h3 class="text-base font-semibold mb-2 text-gray-700">线路配置</h3>
                    <div class="bg-gray-50 p-3 rounded-lg font-mono text-sm">
                        a = 线路1 + 线路2 + 线路3
                    </div>
                </div>

                <div class="mb-4">
                    <h3 class="text-base font-semibold mb-2 text-gray-700">访问逻辑</h3>
                    <ul class="space-y-2 pl-5 text-sm">
                        <li class="flex items-start">
                            <i class="fa fa-check-circle text-success mt-1 mr-2"></i>
                            <p>每次请求时，系统会依次尝试访问线路1 → 线路2 → 线路3</p>
                        </li>
                        <li class="flex items-start">
                            <i class="fa fa-check-circle text-success mt-1 mr-2"></i>
                            <p>当线路1可正常访问时，即完成一次心跳检测</p>
                        </li>
                        <li class="flex items-start">
                            <i class="fa fa-check-circle text-success mt-1 mr-2"></i>
                            <p>若线路1不可用，系统会自动切换到线路2，线路2可用即完成一次心跳检测</p>
                        </li>
                        <li class="flex items-start">
                            <i class="fa fa-check-circle text-success mt-1 mr-2"></i>
                            <p>若线路1和线路2均不可用，系统会尝试线路3，线路3可用即完成一次心跳检测</p>
                        </li>
                    </ul>
                </div>

                <div>
                    <h3 class="text-base font-semibold mb-2 text-gray-700">容错机制</h3>
                    <ul class="space-y-2 pl-5 text-sm">
                        <li class="flex items-start">
                            <i class="fa fa-exclamation-triangle text-warning mt-1 mr-2"></i>
                            <p><strong>错误判定</strong>：当线路1、线路2、线路3均不可访问时，记为一次错误</p>
                        </li>
                        <li class="flex items-start">
                            <i class="fa fa-exclamation-triangle text-warning mt-1 mr-2"></i>
                            <p><strong>容错五次</strong>：指连续进行5轮线路检测（每轮检测3条线路），共15次线路判断</p>
                        </li>
                        <li class="flex items-start">
                            <i class="fa fa-refresh text-primary mt-1 mr-2"></i>
                            <p><strong>重置机制</strong>：只要其中一条线路访问成功，就会重置容错计数</p>
                        </li>
                    </ul>
                </div>
            </div>

            <!-- 流程图解 -->
            <div class="bg-white rounded-xl shadow-md p-4">
                <h3 class="text-base font-semibold mb-4 text-center">线路访问流程</h3>
                
                <div class="relative py-5">
                    <!-- 线路1 -->
                    <div class="flex items-center mb-5">
                        <div class="w-12 h-12 rounded-full bg-primary flex items-center justify-center text-white font-bold text-sm z-10">
                            线路1
                        </div>
                        <div class="h-1 flex-grow bg-gray-200 ml-3 relative">
                            <div class="absolute top-0 right-0 transform -translate-y-1/2 -translate-x-1/2 w-2.5 h-2.5 rounded-full bg-success"></div>
                        </div>
                        <div class="ml-3 bg-success/10 text-success px-3 py-1 rounded-full text-xs font-medium">
                            访问成功 → 完成心跳
                        </div>
                    </div>
                    
                    <!-- 线路2 -->
                    <div class="flex items-center mb-5 pl-6">
                        <div class="w-12 h-12 rounded-full bg-warning flex items-center justify-center text-white font-bold text-sm z-10">
                            线路2
                        </div>
                        <div class="h-1 flex-grow bg-gray-200 ml-3 relative">
                            <div class="absolute top-0 right-0 transform -translate-y-1/2 -translate-x-1/2 w-2.5 h-2.5 rounded-full bg-success"></div>
                        </div>
                        <div class="ml-3 bg-success/10 text-success px-3 py-1 rounded-full text-xs font-medium">
                            线路1失败 → 尝试线路2 → 成功心跳
                        </div>
                    </div>
                    
                    <!-- 线路3 -->
                    <div class="flex items-center mb-5 pl-12">
                        <div class="w-12 h-12 rounded-full bg-danger flex items-center justify-center text-white font-bold text-sm z-10">
                            线路3
                        </div>
                        <div class="h-1 flex-grow bg-gray-200 ml-3 relative">
                            <div class="absolute top-0 right-0 transform -translate-y-1/2 -translate-x-1/2 w-2.5 h-2.5 rounded-full bg-success"></div>
                        </div>
                        <div class="ml-3 bg-success/10 text-success px-3 py-1 rounded-full text-xs font-medium">
                            线路1、2失败 → 尝试线路3 → 成功心跳
                        </div>
                    </div>
                    
                    <!-- 错误情况 -->
                    <div class="flex items-center pl-18">
                        <div class="w-20 h-12 rounded-full bg-gray-700 flex items-center justify-center text-white font-bold text-xs z-10">
                            全部失败
                        </div>
                        <div class="h-1 flex-grow bg-gray-200 ml-3 relative">
                            <div class="absolute top-0 right-0 transform -translate-y-1/2 -translate-x-1/2 w-2.5 h-2.5 rounded-full bg-danger"></div>
                        </div>
                        <div class="ml-3 bg-danger/10 text-danger px-3 py-1 rounded-full text-xs font-medium">
                            3条线路均失败 → 记为1次错误
                        </div>
                    </div>
                    
                    <!-- 连接线 -->
                    <div class="absolute left-6 top-10 bottom-10 w-0.5 bg-gray-200"></div>
                    <div class="absolute left-12 top-20 bottom-20 w-0.5 bg-gray-200"></div>
                    <div class="absolute left-18 top-30 bottom-30 w-0.5 bg-gray-200"></div>
                </div>
            </div>
        </section>

        <!-- 总结说明 -->
        <section class="mb-6">
            <h2 class="text-[clamp(1rem,2vw,1.3rem)] font-semibold mb-4 flex items-center">
                <i class="fa fa-list-alt text-primary mr-2"></i>总结说明
            </h2>
            
            <div class="bg-primary/5 rounded-xl p-4 border border-primary/20 text-sm">
                <p class="text-gray-800 mb-2">系统会按顺序依次访问各条线路，只要其中一条线路访问成功，就视为一次有效心跳，并重置容错计数。</p>
                <p class="text-gray-800 mb-2">只有当所有线路都访问失败时，才会记录一次错误。容错五次意味着允许连续出现五次这样的错误（即连续15条线路均不可用）。</p>
                <p class="text-gray-800 font-medium">这种机制确保了服务的高可用性，最大限度减少因单条线路故障导致的服务中断。</p>
            </div>
        </section>

        <!-- 页脚 -->
        <footer class="text-center text-gray-500 mt-8 pt-4 border-t border-gray-200 text-xs">
            <p>© 2023 网络验证服务 | 域名与线路机制说明</p>
        </footer>
    </div>

    <script>
        // 为域名卡片添加悬停效果
        document.querySelectorAll('.domain-highlight').forEach(card => {
            card.addEventListener('mouseenter', () => {
                card.classList.add('translate-x-1');
            });
            card.addEventListener('mouseleave', () => {
                card.classList.remove('translate-x-1');
            });
        });

        // 平滑滚动
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                // 如果有锚点目标则滚动到目标位置
                if (this.getAttribute('href') !== '#') {
                    document.querySelector(this.getAttribute('href')).scrollIntoView({
                        behavior: 'smooth'
                    });
                }
            });
        });
    </script>
</body>
</html>
    